<div class="text-center h2 mb-4">{{ questionnaire_name }}</div>
<form action="" method="post" name="ans" id="ans">
    {% for q in question %}
        <div class="mb-3 mt-3">
            {% if q.required_question == 1 %}<span style="color: red;">*</span>
                <label for="{{ q.id }}" class="form-label">{{ q.question_text }}:</label>
                <input type="text" class="form-control" id="{{ q.id }}" placeholder=""
                       name="{{ q.id }}" required >
            {% else %}
                <label for="{{ q.id }}" class="form-label">{{ q.question_text }}:</label>
                <input type="text" class="form-control" id="{{ q.id }}" placeholder=""
                       name="{{ q.id }}" >
            {% endif %}
        </div>
    {% endfor %}
    <div class="d-flex justify-content-center">
        <div class="row">
            <div class="col">
                <button type="submit" class="btn btn-primary" onclick="clickSubmit()">确定提交</button>
            </div>
        </div>

    </div>
</form>
<script type="text/javascript">

    function clickOnceAgent() {
        document.ans.action="/questionaire/add_answer_go_on/";
    }

    function clickSubmit(){
        document.ans.action="/questionaire/add_answer/";
    }
</script>